package calorie.com.calorie.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lxh.baselibray.util.TimeUtils;

import com.lxh.baselibray.util.TimeUtils;

import java.util.List;

import calorie.com.calorie.R;
import calorie.com.calorie.response.ConsumptionRecordResponce;

public class ConsumptionRecordAdapter extends BaseQuickAdapter<ConsumptionRecordResponce.DataBean, BaseViewHolder> {
    public ConsumptionRecordAdapter(int layoutResId, @Nullable List<ConsumptionRecordResponce.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ConsumptionRecordResponce.DataBean item) {
        int rType = item.getRType();//rtype(添加用户为1，购买加速包为2,购买商品为3)
        switch (rType) {
            case 1:
                helper.setText(R.id.tv_name, "消费类型：创建帐户");
                break;
            case 2:
                helper.setText(R.id.tv_name, "消费类型：购买加速");
                break;
            case 3:
                helper.setText(R.id.tv_name, "消费类型：购买商品");
                break;
        }

        helper.setText(R.id.tv_time, TimeUtils.millis2String(item.getTime()))
                .setText(R.id.tv_coin, item.getTokenType() + "：" + item.getTokenNum());

    }
}
